package com.chinasofti.collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class Demo03 {
    public static void main(String[] args) {
        Collection<String> c = new ArrayList<>();
        //添加元素
        c.add("张三");
        c.add("nihao ");
        c.add("java");
        Iterator<String> it = c.iterator();
        while (it.hasNext()){
            String s = it.next();
            if ("java".equals(s)){
                it.remove();
            }

        }
        System.out.println(c);
//        for(String a:c){
//            System.out.println(a);
//        }
    }
}
